home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
050
/
turbodos.arc
/
README.DOC
< prev
next >
Wrap
Text File
|
1985-12-13
|
7KB
|
163 lines
Introduction:
------------
This library contains procedures which allow you to execute DOS
commands and many other programs from within a running Turbo Pascal
program. The assembler routine TURBORUN.COM performs the
actual execution of the external commands via DOS function 4B. The
sample Turbo Pascal program PIBDODOS demonstrates how to use TURBORUN.COM
in two different ways:
(1) To directly perform a selected command;
(2) To start up a secondary command processor so that
any set of commands can be executed. Control is
returned to the Turbo routine PIBDODOS by entering EXIT.
Files:
-----
Libbrary PIBDODOS.LBR contains the following files:
README.DOC --- what you are reading now.
PIBDODOS.PQS --- squeezed Turbo Pascal routine showing
how to use TURBORUN.COM (see below).
TURBORUN.COM --- Assembled external routine for invoking
DOS commands from Turbo Pascal.
TURBORUN.AQM --- Squeezed assembler source from which
TURBORUN.COM was created.
PIBDODOS.PQS and TURBORUN.AQM are both squeezed files. They were
squeezed without the time and date stamp, so your favorite
unsqueezer should have no difficulty. I especially recommend
Alan Losoff's ALUSQ.COM.
Credits:
-------
The external routine TURBORUN.COM was written by John Cooper and
John Falconer. The sample routine PIBDODOS was written by Philip R. Burns.
Cooper and Falconer provided a sample routine, but theirs required
that COMMAND.COM be present in the active directory in order to work,
and they did not show how to bring up a secondary command processor.
What PIBDODOS does:
------------------
PIBDODOS first searches the DOS environment string for COMSPEC= to
obtain the current location of COMMAND.COM. It then prompts for a
command to execute. If a command is entered, then it is passed to DOS
for execution, if possible. After the command is executed, control returns
to PIBDODOS. If no command is entered -- i.e., a null line is input --
then PIBDODOS brings up a secondary DOS command processor. DOS commands
may be entered as desired. Entering 'EXIT' returns control to
PIBDODOS. PIBDODOS then prompts for another command to execute, and so on,
until 'END' is entered.
Using PIBDODOS:
--------------
You may use the file TURBORUN.COM as provided in the library. If you
prefer, you may extract the deck TURBORUN.AQM, unsqueeze it, and follow
the directions in that deck's comments to produce TURBORUN.COM.
Unsqueeze PIBDODOS.PQS --> PIBDODOS.PAS. Invoke Turbo Pascal,
making sure that TURBORUN.COM is in the same directory as PIBDODOS.PAS.
Compile PIBDODOS.PAS to a .COM file, and also set the maximum heap
size (Axxxx in O)ptions) to what the Turbo program will need to
execute. Any remaining memory will be used for executing external
commands.
You can find out more information by reading the comments in the
source file TURBORUN.ASM.
Glitches:
--------
There are some glitches with the approach used by PIBDODOS/TURBORUN.
DOS may freeze up if there is not enough memory to execute the command,
or if the command clobbers memory that does not belong to it. In these
cases, a re-boot is required.
Comments:
--------
Send comments, suggestions, etc. to PHILIP BURNS on either of the
following two Chicago BBSs:
Gene Plantz's BBS (312) 882 4227
Ron Fox's BBS (312) 940 6496
If you find a problem in TURBORUN.ASM, you may also want to notify
Cooper and Falconer -- their address is in the comments of TURBORUN.ASM.
Thanks,
Phil Burns
April, 1985
Update: April 28, 1984
Turborun.asm and Turborun.com have been updated as follows:
Modified Turborun to work with both 2.0 and 3.0 versions of Turbo Pascal.
This required a new method of locating Turbo's maximum stack segment size.
TP 2.0 stores this 7 bytes ahead of the beginning of actual user code, but
version 3.0 stores it 20 bytes ahead. Fortunately, both versions store a
pointer to the user code area at MemW[Cseg:$101]. SSMax is located at
MemW[Cseg:$101] + $112. From Turbo, SSMax can be obtained with the code:
Procedure Dummy(var SSMax : integer);
var
User : integer;
begin
User := MemW[Cseg:$101];
SSMax := MemW[Cseg:User + $112];
end;
Keep in mind that if your maximum stack size is greater than MaxInt (32767),
or 524,272 bytes, SSMax will be NEGATIVE. (If your reading this Phillipe
Kahn, how about an unsigned integer scalar type in the next release ? You
could call it WORD with a max value of 65535. Come to think of it, a
DOUBLE WORD would also come in handy.....)
With the change in locating SSMax, the placement of your proc which calls
the EXTERNAL program Turborun is no longer important. In order to demonstrate
this fact, I have made a slight modification to PibDoDos.pas. User code now
begins with the function UpCaseStr. RunExt follows UpCaseStr.
I have recompiled PibDoDos under Turbo Pascal 2.0B and 3.0B. The only
apparent difference is that 3.0 no longer clears the screen. It has been
sucessfully run on an IBM PC with a GLC (Pegasus) 10M hard disk and on a
Compaq Plus.
Note on compiling under Turbo Pascal 2.0B:
------------------------------------------
This version contains a bug which is evident when compiling an EXTERNAL COM
program. You have to compile twice. The first time simply compile with no
options to memory. Then select O, C, I ####, A ####, Q, C. #### represents
your minimum and maximum stack sizes. The resulting COM file will run
correctly. 3.0 doesn't require the memory compile.
Acknowledgement:
----------------
This work is heavily based on the prior work done by Mssrs Cooper, Falconer
and Burns.
I was able to discover a version-independent method of locating SSMax by
analysing the code of a set of programs collectively known as TurboLink,
marketed by Pathfinder Software Inc. TurboLink is advertised to allow
up to 576k of Turbo Pascal Code to be resident, and to be accessed from
a central program written in Turbo Pascal, Compiled Basic or Interpreted
Basic. The only problem is that the version I have (2.0) will not work
with a system with more than 512k of ram (They forgot about Maxint).
Squeezing 576k of Turbo code plus a central program into a 512k machine
should be quite a trick! In any case, Pathfinder uses the method of locating
SSMax that I have incorporated into Turborun.asm.
Thomas P. Devitt
Pseudonym Software
(818) 796-7933